#pragma once
#include "../Gui.h"
#include "LanDef.h"
#include "UtilInclude.h"

#define LANGUAGE_DECLARE   BOOL bRet = TRUE;\
	CLanguage *pLang = CLanguage::GetInstance();\
	if(!pLang)\
			{\
				bRet = FALSE;\
			}\

#define LAN_GETTEXT(x)		pLang->GetText(x)

/**
*@brief Uses a map to hold one of the language's all string \n
*You can get the string from the language map by passing the corresponding string key
*/

class GUI_API CLanguage
{
public:
	virtual ~CLanguage(void);

public:
	/**
	 *@brief  Get string by key
	 *@param  strKey The predefined key
	 *@return The corresponding string
	*/
	wstring GetText(wstring strKey);

	/**
	*@brief  Specifies the new language file
	*@param  strFileName The new language file name
	*@retval TRUE Operation success
	*@retval FALSE Operation fail
	*/
	BOOL   SetLanguageFile(wstring strFileName);

	/**
	*@brief Get the single language instance
	*@return The language instance pointer
	*/
	static CLanguage* GetInstance();

	static void Free();

private:
	map<wstring,wstring> m_mapItems;
	static CLanguage*    g_pInstance;
	static wstring      g_strLangFile;

private:
	BOOL InitLanMap();
protected:
	CLanguage(void);
};
